From a9e181eb84081724450f727cf34f7d853f83f272 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 10 Mar 2004 18:19:16 +0000 Subject: [PATCH] bitkeeper revision 1.778 (404f5c24HB4-3O5d1LoEBPgmh5h6tg) Makefile: Create Xen interface symlink. time.c, hypervisor-if.h, kernel.c: Fix shared_info to make CPU TSC arch-dependent. --- extras/mini-os/kernel.c | 2 +- extras/mini-os/time.c | 4 ++-- xen/arch/i386/time.c | 6 ++---- xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h | 11 ++++------- .../hypervisor-ifs/arch-x86_64/hypervisor-if.h | 12 ++++-------- xen/include/hypervisor-ifs/hypervisor-if.h | 11 +++-------- xenolinux-2.4.25-sparse/arch/xeno/Makefile | 3 +++ xenolinux-2.4.25-sparse/arch/xeno/kernel/time.c | 4 ++-- 8 files changed, 21 insertions(+), 32 deletions(-) diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c index 4af99cdd35..aa944f50c3 100644 --- a/extras/mini-os/kernel.c +++ b/extras/mini-os/kernel.c @@ -109,8 +109,8 @@ void start_kernel(start_info_t *si) printk(" %lx", si->net_rings[i]); }; printk("\n"); printk(" blk_ring: 0x%lx\n", si->blk_ring); -#endif printk(" dom_id: %ld\n", si->dom_id); +#endif printk(" flags: 0x%lx\n", si->flags); printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); diff --git a/extras/mini-os/time.c b/extras/mini-os/time.c index 12356b0a03..df3a62e4dd 100644 --- a/extras/mini-os/time.c +++ b/extras/mini-os/time.c @@ -70,7 +70,7 @@ static void get_time_values_from_xen(void) rmb(); shadow_tv.tv_sec = HYPERVISOR_shared_info->wc_sec; shadow_tv.tv_usec = HYPERVISOR_shared_info->wc_usec; - shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp; + shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp.tsc_bits; shadow_system_time = HYPERVISOR_shared_info->system_time; rmb(); } @@ -167,7 +167,7 @@ void init_time(void) __cpu_khz = HYPERVISOR_shared_info->cpu_freq; cpu_khz = (u32) (__cpu_khz/1000); - rdtsc_bitshift = HYPERVISOR_shared_info->rdtsc_bitshift; + rdtsc_bitshift = HYPERVISOR_shared_info->tsc_timestamp.tsc_bitshift; cpu_freq = HYPERVISOR_shared_info->cpu_freq; scale = 1000000LL << (32 + rdtsc_bitshift); diff --git a/xen/arch/i386/time.c b/xen/arch/i386/time.c index 947408882d..6276326247 100644 --- a/xen/arch/i386/time.c +++ b/xen/arch/i386/time.c @@ -280,12 +280,10 @@ void update_dom_time(shared_info_t *si) si->time_version1++; wmb(); - /* NB. These two values don't actually ever change. */ si->cpu_freq = cpu_freq; - si->arch.rdtsc_bitshift = rdtsc_bitshift; - + si->tsc_timestamp.tsc_bitshift = rdtsc_bitshift; + si->tsc_timestamp.tsc_bits = tsc_irq; si->system_time = stime_irq; - si->tsc_timestamp = tsc_irq; si->wc_sec = xtime.tv_sec; si->wc_usec = xtime.tv_usec; si->wc_usec += (jiffies - wall_jiffies) * (1000000 / HZ); diff --git a/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h b/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h index fefc24a633..e3b32cb4b5 100644 --- a/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h +++ b/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h @@ -86,13 +86,10 @@ typedef struct unsigned long ss; } execution_context_t; -/* - * Shared info specific to the architecture in question - */ -typedef struct arch_shared_info_st { - unsigned int rdtsc_bitshift; /* tsc_timestamp uses N:N+31 of TSC. */ -} arch_shared_info_t; - +typedef struct { + unsigned long tsc_bits; /* 32 bits read from the CPU's TSC. */ + unsigned int tsc_bitshift; /* 'tsc_bits' uses N:N+31 of TSC. */ +} tsc_timestamp_t; /* * The following is all CPU context. Note that the i387_ctxt block is filled diff --git a/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h b/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h index 53354f9ddf..0a1101b314 100644 --- a/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h +++ b/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h @@ -85,14 +85,10 @@ typedef struct unsigned long ss; } execution_context_t; -/* - * Xen/guestos shared data -- pointer provided in start_info. - * NB. We expect that this struct is smaller than a page. - */ -typedef struct arch_shared_info_st { - unsigned int rdtsc_bitshift; /* tsc_timestamp uses N:N+31 of TSC. */ -} arch_shared_info_t; - +typedef struct { + unsigned long tsc_bits; /* 32 bits read from the CPU's TSC. */ + unsigned int tsc_bitshift; /* 'tsc_bits' uses N:N+31 of TSC. */ +} tsc_timestamp_t; /* * The following is all CPU context. Note that the i387_ctxt block is filled diff --git a/xen/include/hypervisor-ifs/hypervisor-if.h b/xen/include/hypervisor-ifs/hypervisor-if.h index 2d708a5a4f..afba398828 100644 --- a/xen/include/hypervisor-ifs/hypervisor-if.h +++ b/xen/include/hypervisor-ifs/hypervisor-if.h @@ -209,7 +209,6 @@ typedef struct shared_info_st { * Time: The following abstractions are exposed: System Time, Clock Time, * Domain Virtual Time. Domains can access Cycle counter time directly. */ - u64 cpu_freq; /* CPU frequency (Hz). */ /* @@ -221,20 +220,17 @@ typedef struct shared_info_st { */ unsigned long time_version1; /* A version number for info below. */ unsigned long time_version2; /* A version number for info below. */ - unsigned long tsc_timestamp; /* TSC at last update of time vals. */ + tsc_timestamp_t tsc_timestamp; /* TSC at last update of time vals. */ u64 system_time; /* Time, in nanosecs, since boot. */ unsigned long wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */ unsigned long wc_usec; /* Usecs 00:00:00 UTC, Jan 1, 1970. */ - - /* Domain Virtual Time */ - u64 domain_time; - + u64 domain_time; /* Domain virtual time, in nanosecs. */ + /* * Timeout values: * Allow a domain to specify a timeout value in system time and * domain virtual time. */ - u64 wall_timeout; u64 domain_timeout; @@ -247,7 +243,6 @@ typedef struct shared_info_st { net_idx_t net_idx[MAX_DOMAIN_VIFS]; execution_context_t execution_context; - arch_shared_info_t arch; } shared_info_t; diff --git a/xenolinux-2.4.25-sparse/arch/xeno/Makefile b/xenolinux-2.4.25-sparse/arch/xeno/Makefile index 041f2fc8cd..e9822809e7 100644 --- a/xenolinux-2.4.25-sparse/arch/xeno/Makefile +++ b/xenolinux-2.4.25-sparse/arch/xeno/Makefile @@ -111,6 +111,9 @@ archclean: @$(MAKEBOOT) clean archmrproper: + rm -f include/asm-xeno/hypervisor-ifs/arch archdep: + rm -f include/asm-xeno/hypervisor-ifs/arch + ( cd include/asm-xeno/hypervisor-ifs ; ln -sf arch-$(SUBARCH) arch) @$(MAKEBOOT) dep diff --git a/xenolinux-2.4.25-sparse/arch/xeno/kernel/time.c b/xenolinux-2.4.25-sparse/arch/xeno/kernel/time.c index 335756b050..0d41748c82 100644 --- a/xenolinux-2.4.25-sparse/arch/xeno/kernel/time.c +++ b/xenolinux-2.4.25-sparse/arch/xeno/kernel/time.c @@ -211,7 +211,7 @@ static void __get_time_values_from_xen(void) rmb(); shadow_tv.tv_sec = HYPERVISOR_shared_info->wc_sec; shadow_tv.tv_usec = HYPERVISOR_shared_info->wc_usec; - shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp; + shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp.tsc_bits; shadow_system_time = HYPERVISOR_shared_info->system_time; rmb(); } @@ -604,7 +604,7 @@ void __init time_init(void) xtime.tv_usec = HYPERVISOR_shared_info->wc_usec; processed_system_time = shadow_system_time; - rdtsc_bitshift = HYPERVISOR_shared_info->rdtsc_bitshift; + rdtsc_bitshift = HYPERVISOR_shared_info->tsc_timestamp.tsc_bitshift; cpu_freq = HYPERVISOR_shared_info->cpu_freq; scale = 1000000LL << (32 + rdtsc_bitshift); -- 2.30.2